/**
 * $Revision: 1.0 $
 * $Author: Geln Yang $
 * $Date: Jun 16, 2010 11:31:15 PM $
 *
 * Author: Geln Yang
 * Date  : Jun 16, 2010 11:31:15 PM
 *
 */
package com.gooex.web.action.gbuy.usercenter.appmsg;

import java.util.List;

import com.gooex.domain.common.AppMessage;
import com.gooex.web.action.BaseProtectedAction;


/**
 * @author Geln Yang
 * @version 1.0
 */
public class AppMsgAction extends BaseProtectedAction {

	private String id;

	private AppMessage message;

	private List<AppMessage> messages;

	public String viewAppMsg() throws Exception {
		message = appMessageManager.getMessage(id);
		if (message != null) {
			message.setRead(true);
			appMessageManager.saveMessage(message);
		}
		return SUCCESS;
	}

	public String viewMsgList() throws Exception {
		messages = appMessageManager.getMessageByTo(getCurrentUser().getEmail(), page);
		return SUCCESS;
	}

	public List<AppMessage> getMessages() {
		return messages;
	}

	public AppMessage getMessage() {
		return message;
	}

	public void setId(String id) {
		this.id = id;
	}

}
